Closed
Bug 423442
Opened 16 years ago
Closed 16 years ago
XML nodeValue breakes after 4096 chars when file loaded thru AJAX
Categories
(Toolkit :: View Source, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 194231
People
(Reporter: jurik81, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12 When I get a XML File (wether a pure example.xml or echo thru php and modified headers) and it's nodeValue has more then 4096 chars, it will break it and go to next step. That's the code my HTML page: <html> <head> <title>AJAX</title> <script type="text/javascript"> var http = null; if (window.XMLHttpRequest) { http = new XMLHttpRequest(); } else if (window.ActiveXObject) { http = new ActiveXObject("Microsoft.XMLHTTP"); } window.onload = function() { if (http != null) { http.open("GET", "test.xml", true); http.onreadystatechange = ausgeben; http.send(null); } } function ausgeben() { if (http.readyState == 4) { alert('wrong length of XML nodeValue before innerHTML: '+http.responseXML.getElementsByTagName('links')[0].firstChild.nodeValue.length); document.body.innerHTML = http.responseXML.getElementsByTagName('links')[0].firstChild.nodeValue; alert('wrong length of XML nodeValue after innerHTML: '+document.body.innerHTML.length); } } </script> </head> <body> <ul id="Liste"></ul> </body> </html> And that's the XML file: <?xml version="1.0" encoding="UTF-8"?> <links>{more then 4096 chars}</links> Replace {more then 4096 chars} with more then 4096 chars, in example 5000 ;) It doesn matter if you've only the character X there or whole html syntax - it won't work. I do not know why there is this restriction or 'bug' - but neither IE nor Opera has a limit for nodeValue from XML file. Reproducible: Always Steps to Reproduce: 1.click reload 2.press F5 3.redo step 1 or 2 ;) Actual Results: prints out only 4096 chars instead of whole nodeValue of xml node Expected Results: should print out a lot more characters I'm using Firefox/2.0.0.12 (like build info above) with a couple of Add-ons: ChatZilla[de] v0.9.81 ColorZilla[de] v1.9 CSSViewer 1.0.2 Firebug 1.05 Flashblock 1.5.5 Html Validator[de] 0.7.9.5 Life HTTP Headers 0.13.1 Skype extension for Firefox 2.2.0.70 But I doubt that those mods have anything to do with the problem.
Duplicate of/related to Bug https://bugzilla.mozilla.org/show_bug.cgi?id=194231
Above the showcase link has now a different function 'ausgeben()': function ausgeben() { if (http.readyState == 4) { alert(http.responseXML.getElementsByTagName('links')[0].childNodes.length); for(var i = 0; i < http.responseXML.getElementsByTagName('links')[0].childNodes.length; i++){ alert('Truncated OBJ Number: '+i+'\nCharacters (bytes): '+http.responseXML.getElementsByTagName('links')[0].childNodes[i].nodeValue.length); document.body.innerHTML+=http.responseXML.getElementsByTagName('links')[0].childNodes[i].nodeValue; } } } It's now clear what firefox does ... it just truncates a nodeValue at 4096 bytes and puts the truncated part into next node. Solution is now to read everything in a loop and so on ... it would be nice if this truncate thing with 4096 is anywhere mentioned... anywhere beside the bugforum ;)
Comment 3•16 years ago
|
||
Or you could just get the .textContent and avoid the loop, I guess.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Yes, then I've to write extra code for FF and extra code for all other browser. But I guess that's a IE problem, not FF :) - thanks for your reply.
Assignee | ||
Updated•16 years ago
|
Product: Firefox → Toolkit
You need to log in
before you can comment on or make changes to this bug.
Description
•